﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ecopsy.DataTier;
using AgencyEntityLib.Context;
using System.Web;

namespace AgencyEntityLib.BaseEntity
{
    /// <summary>
    /// Бизнесс объекты с движком бизнесс логики поставляемым агентсовм
    /// </summary>
    public class BusinessRulesEntity : SqlAgencyEntity
    {

        BusinesRulesEngine _BRE = null;
        [EntityNonSerialized ]
        public virtual  BusinesRulesEngine BusinesRulesEngine
        {
            get            
            {
                if (null == _BRE)
                {
                    wsBusinesEngine ws = (wsBusinesEngine)AgencyLib_GlobalConstants.CurrentAgency.WS_FactoryList[WS_FactoryList.wsKey_BusinesEngine];
                    _BRE=ws.GetBusinesRulesEngine(this);
                }
                return _BRE;
                    

            }
            //set 
            //{
            //    if (HttpContext.Current.Session != null)
            //    {
            //        Agency a = AgencyLib_GlobalConstants._getAgency();
            //        a.SetBusinesRulesEngine(this, ref _BRE);
            //    }
            //    _BRE = value;
            //}
            

        }

    }
}
